import React, { Component } from 'react'
import { Card,WingBlank,WhiteSpace } from 'antd-mobile'
import PropTypes from 'prop-types'

class UserCard extends Component{
  static propTypes = {
    dataList: PropTypes.array.isRequired
  }
    render(){    
        const data = this.props.dataList
        return (
         <WingBlank>
           <WhiteSpace size="lg" />
           {data.map(v=>(
              v.avatar? <Card key={v._id}>
                  <Card.Header
                    title={v.user}
                    thumb={require(`../images/${v.avatar}.jpg`)}
                    thumbStyle={{width:50}}
                    extra={v.title}
                  />
                  <Card.Body>
                    {v.type==='boss'?<div>公司：{v.company}</div>:null}
                    {v.desc.split('\n').map(item=>
                         <div key={item}>{item}</div>
                    )}
                    {v.type==='boss'?<div>薪资：{v.money}</div>:null}
                  </Card.Body>
                </Card>:null
            ))}
           </WingBlank>
        )
    }
}

export default UserCard